package game;

import java.io.Serializable;


public class Player implements Serializable {
	
	public Player(String login, String password, String role, int ranking) {
		this.login = login;
		this.password = password;
		this.role = role;
		this.ranking = ranking;
		this.isOnline = false;
	}
	
	
	public Player(String login, String password, String role) {
		this(login, password, role, 0);
	}
			
		
	public String getLogin() {
		return this.login;
	}
		
	
	public String getPassword() {
		return this.password;
	}
	
	
	public void setPassword(String password) {
		this.password = password;
	}
	

	public String getRole() {
		return role;
	}


	public void setRole(String role) {
		this.role = role;
	}


	public int getRanking() {
		return this.ranking;
	}
	
	
	public void setRanking(int ranking) {
		this.ranking = ranking;
	}
	
	
	public void incRanking(int ranking) {
		this.ranking += ranking;
	}
	
	
	public boolean isOnline() {
		return isOnline;
	}
	
	
	public void setOnline(boolean isOnline) {
		this.isOnline = isOnline;
	}
	
	
	@Override
	public boolean equals(Object o) {
		if (o instanceof Player)
			return this.login.equals(((Player) o).login);
		
		return false;
	}
	
	
	@Override
	public String toString() {
		return login;
	}
	
	
	private String login;
	private String password;
	private String role;
	private int ranking;
	private boolean isOnline;
	
	
	private static final long serialVersionUID = 1L;
}
